<!--begin-->
<div id="khv"></div>
<div class="section">
  <div class="section">
   <div class="section-title">
      Chia Khách Hàng Cho Nhân Viên Phụ Trách Phát Hành
 	</div>
    <?php 
    	if($_GET['print'] !="true" )
        { 
    ?> 
    <div class="right">
    <a class="button print" id="btnPrint">In</a>
    <a class="button exit" href="?route=deliman/home">Đóng</a>
    </div>
    <?php } ?>
    <div class="clearer">&nbsp;</div>
  </div>
  <div class="section-content padding1">
     <div>
        <?php 
            if($_GET['print'] !="true" )
            { 
        ?> 
      <form>
        <table>
          <thead>
            <tr>
              <td style="text-align:right;"><label>Khu vực:</label></td>
              <td>
              
              <select name="qlkhuvuc" id="qlkhuvuc">
              <option value="0">-----Chọn tất cả-----</option>
                  <?php foreach($khuvucs as $khuvucdangphutrach){ ?>
                  <option value="<?php echo $khuvucdangphutrach['khuvucid']?>"><?php echo $this->string->getPrefix("&nbsp; &nbsp; &nbsp; &nbsp;",$khuvucdangphutrach['level']);?><?php echo $khuvucdangphutrach['tenkhuvuc']?></option>
                  <?php }?>
                </select>
                
                <a class="button-other search"  style="margin-bottom: -29px;" id="btntim"></a>
                </td>
             
            </tr>
            
          </thead>
        </table>
      </form>
      <form action="" method="post" name="postlist" id="postlist">
       <?php } ?>
      	<table>
          <thead>
           <?php
       		
            if($khachhangchuaconhanvienphutrach !=0)
            	{
            ?>
            <tr>
           <!--&nhanvienid=0&khuvucid=<?php echo $khachang_khuvucid ?>-->
            <a href="?route=deliman/chiakhachhangdetail"> +Khách hàng mới(<?php echo $khachhangchuaconhanvienphutrach?>)</a></td>
            </tr>
            <?php 
           		 }
                 else
                 {
            ?>
            <td> +Khách hàng mới(0)</td>
            <?php     
                 }
            ?>
            
          </thead>
        </table>
       
     	<?php foreach($phutrachkhuvuc as $item)
        		{
                if($item['loaikhuvuc']=='khuvuc')
                	{
                    if(count($item['data_nhanvien']) )
                        {
        ?>
       
        <table width="100%" class="data-table">
            <thead>
            	<tr>
                	<th>
                    	<!--<?php echo $item['tentinhthanh']?>
                        <?php echo $item['tenquanhuyen']?>
                        <?php echo $item['tenphuongxa']?>-->
                        <?php echo $item['tenkhuvuc']?>
                    </th>
                </tr>
            </thead>
            <tbody>
            <?php
				
             ?>
            	<?php foreach($item['data_nhanvien'] as  $abc)
              	 		 {
                 ?>
                    <tr>
                        <td>
                        Nhân viên :
                         <?php echo  $abc['masonhanvien'] ?> -
                         <?php echo  $abc['hoten'] ?>
                         <a href="?route=deliman/chiakhachhangdetail&nhanvienid=<?php  echo $abc['nhanvienid'] ?>&khuvucid=<?php  echo $item['khuvucid'] ?>">(Xem danh sách khách hàng)-Số lượng</a>
                         (<?php echo $abc['soluongkhachhang'] ?>)
                         </td>
                    </tr>
                <?php 
               				
                      	 }
                ?>
            </tbody>
        </table>
       
      	<?php 		}
        		}
       		 }
         ?>      

       
      </form>
    </div>
    <div>
      <div class="clearer">&nbsp;</div>
    </div>
  </div>
  <div class="section-bottom"></div>
</div>
<!--end--> 
<script language="javascript">
		//start script
		$(document).ready(function(){
			/*$('#qlkhuvuc').change(function(){
				
				window.location="?route=deliman/chiakhachhangchonhanvienphutrachphathanh&khuvucid="+$('#qlkhuvuc').val();
				
			});*/
			
			$('#btntim').click(function(){
				
				window.location="?route=deliman/chiakhachhangchonhanvienphutrachphathanh&khuvucid="+$('#qlkhuvuc').val();
				
			});
			
		
			$('#qlkhuvuc').val("<?php echo $_GET['khuvucid']?>");
		$('#btnPrint').click(function(){
		
			var url = window.location+"&print=true";
			 var result = window.showModalDialog(url,"", "dialogWidth:1000px; dialogHeight:450px; center:yes");
		});
			
		});//end

	
</script>
<?php if($_GET['print'] =="true" ){ ?>
	<script language="javascript">
        window.print();
    </script>
<?php } ?>